package experiment2_4;


class Cylinder {
    private Circle circle;
    private double height;

    public Cylinder(Circle circle, double height) {
        this.circle = circle;
        this.height = height;
    }

    public double getVolume() {
        double area = circle.getArea();
        return area * height;
    }

    public static class Circle {
        private double radius;

        public Circle(double radius) {
            this.radius = radius;
        }

        public double getArea() {
            return Math.PI * radius * radius;
        }
    }
}

class CylinderTest {
    public static void main(String[] args) {
        Cylinder cylinder1 = new Cylinder(new Cylinder.Circle(2.0), 5.0);
        System.out.println("Cylinder1 Volume: " + cylinder1.getVolume());

        Cylinder cylinder2 = new Cylinder(new Cylinder.Circle(3.0), 8.0);
        System.out.println("Cylinder2 Volume: " + cylinder2.getVolume());
    }
}
